package net.ywd.xp1024search.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.ywd.xp1024search.entity.UsdtCny;
import net.ywd.xp1024search.mapper.UsdtCnyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/gate-io")
public class GateIoController {

    @Autowired
    private UsdtCnyRepository usdtCnyRepository;
    @Autowired
    private ObjectMapper objectMapper;

    @RequestMapping(value = "/usdt-cny/all")
    public String usdtCnyAll() throws JsonProcessingException {
        List<UsdtCny> list = usdtCnyRepository.findWithout0();
        return objectMapper.writeValueAsString(list);
    }
}
